package com.autoTools.view;

import java.awt.Button;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import com.autoTools.router.Router;
import com.autoTools.util.Constants;
import com.autoTools.util.LogUtil;
public class ButtonView extends BaseView
{
	private Button mButton = null;

	public ButtonView()
	{
		mButton = new Button();
		mButton.setEnabled(true);
		mButton.setVisible(true);
		final ButtonView BUTTONVIEW = this;
		mButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated method stub
				if(BUTTONVIEW != null){
					String comm = BUTTONVIEW.getActionCommand(Constants.ONCLICK);
					if(comm != null){
						Router.run(comm, null);
					}
				}
			}
		});
		BaseInit(mButton);
	}

	public boolean addChild(BaseView child)
	{
		boolean state = false;
		LogUtil.sysLog(TAG, "addChild Error:child is not extends Component");
		return state;
	}
	
	public void setLabel(String label){
		super.setLabel(label);
		mButton.setLabel(label);
	}
	
}
